<?php

class RecordController extends Zend_Controller_Action
{

	public function init()
	{
		/* Initialize action controller here */
	}

	public function indexAction()
	{
		$this->_redirect('/record/list');
	}

	public function listAction()
	{
		$this->view->records = array(
		array("id" => 0, "name" => "record 1", "data" => "data 1"),
		array("id" => 1, "name" => "record 2", "data" => "data 2"),
		array("id" => 2, "name" => "record 3", "data" => "data 3"),
		);
	}

	public function editAction()
	{
		if($this->_request->isGet()){
			

			$records = array(
			array("id" => 0, "name" => "record 1", "data" => "data 1"),
			array("id" => 1, "name" => "record 2", "data" => "data 2"),
			array("id" => 2, "name" => "record 3", "data" => "data 3"),
			);
			//$id = $this->getRequest()->getParam('id');
			$id = $this->_getParam('id');
			$this->view->id = $id;
			$this->view->record = $records[$id];
		}
	}

	public function createAction()
	{
		$this->view->id = '-1';
		$this->view->record = array('name'=>'','data'=>'');
		$this->render('edit');
	}

	public function saveAction()
	{
		/* here we will save the record */
		$this->_redirect('/record/list/');
	}

	public function deleteAction()
	{
		/* here we will delete the record */
		$this->_redirect('/record/list/');
	}


}







